package com.dajie.pt.model;

import java.util.Date;

import com.dajie.common.util.StringUtil;
import com.dajie.pt.entity.base.BaseEntity;
import com.dajie.pt.utils.Weight;

/**
 * 
 * @author panbing.wu
 * 
 */
public class EduInfo extends BaseEntity
{

	private static final long serialVersionUID = 3453913420277822991L;

	@Weight(value = 60)
	private String schoolName;

	@Weight(value = 60)
	private String majorName;

	@Weight(value = 60)
	private Integer degree;

	@Weight(value = 30)
	private Date startDate;
	
	@Weight(value = 30)
	private Date endDate;

	public EduInfo()
	{
	}

	public EduInfo(String schoolName, String majorName, Integer degree, Date startDate, Date endDate)
	{
		this.schoolName = schoolName;
		this.majorName = majorName;
		this.degree = degree;
		this.startDate = startDate;
		this.endDate = endDate;
	}

	public String getSchoolName()
	{
		return schoolName;
	}

	public void setSchoolName(String schoolName)
	{
		this.schoolName = schoolName;
	}

	public String getMajorName()
	{
		return majorName;
	}

	public void setMajorName(String majorName)
	{
		this.majorName = majorName;
	}

	public Integer getDegree()
	{
		return degree;
	}

	public void setDegree(Integer degree)
	{
		this.degree = degree;
	}

	public Date getStartDate()
	{
		return startDate;
	}

	public Date getEndDate()
	{
		return endDate;
	}

	public void setEndDate(Object endDate)
	{
		this.endDate = castToDate(endDate);
	}

	public void setStartDate(Object startDate)
	{
		this.startDate = castToDate(startDate);
	}

	@Override
	public boolean equals(Object obj)
	{
		if (obj instanceof EduInfo)
		{
			EduInfo eduinfo = (EduInfo) obj;
			if ((eduinfo.getSchoolName() == this.schoolName || (eduinfo.getSchoolName() != null && eduinfo
					.getSchoolName().equals(this.getSchoolName())))
					&& (eduinfo.getMajorName() == this.majorName || ( eduinfo.getMajorName() != null && eduinfo
							.getMajorName().equals(this.getMajorName())))
					&& (eduinfo.getDegree() == this.degree || (eduinfo.getDegree() != null && eduinfo.getDegree()
							.equals(this.getDegree())))
					&& (eduinfo.getStartDate() == this.startDate || (eduinfo.getStartDate() != null && eduinfo
							.getStartDate().equals(this.getStartDate())))
					&& (eduinfo.getEndDate() == this.endDate || (eduinfo.getEndDate() != null && eduinfo.getEndDate()
							.equals(this.getEndDate()))))
			{
				return true;
			}
		}
		return false;
	}
}
